﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ChucNang_Admin_Admin_LayServiceLoHang : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLayLoHang_Click(object sender, EventArgs e)
    {
        HP_WS.LoHangService hpsv = new HP_WS.LoHangService();
        HP_WS.DTO_SanPham[] arrSanPham= hpsv.LayLoHang();
        string chuoi = "<b>Lô Hàng Của HP</b><br />";
        chuoi += "<table border='1' cellspacing='0'>";
        chuoi += "<tr class='rowheader'>";
        chuoi += "<th>Mã SP</th>";
        chuoi += "<th>Tên SP</th>";
        chuoi += "<th>TTCT</th>";
        chuoi += "<th>Hạn SD</th>";
        chuoi += "<th>Số Lượng</th>";
        chuoi += "<th>Giá Cả</th>";
        chuoi += "<th>Chiết Khấu(%)</th>";
        chuoi += "</tr>";
        DataDSTableAdapters.LOHANGTableAdapter lhadapter = new DataDSTableAdapters.LOHANGTableAdapter();
        for (int i = 0; i < arrSanPham.Length; i++)
        {
            HP_WS.DTO_SanPham temp = arrSanPham[i];
            if(i%2==0)
                chuoi += "<tr class='rowchan'>";
            else
                chuoi += "<tr class='rowle'>";
            chuoi += "<td>" + temp.MaSP+ "</td>";
            chuoi += "<td>" + temp.TenSP + "</td>";
            chuoi += "<td>" + temp.ThongTinChiTiet + "</td>";
            chuoi += "<td>" + temp.HanSuDung.ToString("d-M-yyyy") + "</td>";
            chuoi += "<td>" + temp.SoLuong.ToString() + "</td>";
            chuoi += "<td>" + temp.DonGia.ToString() + "/1 SP</td>";
            chuoi += "<td>" + temp.ChietKhau.ToString() + " %</td>";
            chuoi += "</tr>";
            lhadapter.LOHANG_Them(temp.TenSP, temp.MaSP, temp.ThongTinChiTiet, temp.HanSuDung, DateTime.Now, temp.SoLuong, (float)temp.DonGia, temp.ChietKhau, 1, 3);
        }
        chuoi += "</table>";
        lblLoHang.Text = chuoi;
    }
}
